package com.msh.frame.client.base;

import com.msh.frame.client.enums.SortModeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;

@Data
@ToString
public class SortBy {

  @Schema(title = "排序字段")
  private String sortColumn;
  @Schema(title = "主键ID")
  private String sortMode;

  public SortBy(String sortColumn, SortModeEnum sortModeEnum) {
    this.sortColumn = sortColumn;
    this.sortMode = sortModeEnum.getSortMode();
  }

  public SortBy() {
  }

  public static SortBy asc(String sortColumn){
    return new SortBy(sortColumn, SortModeEnum.ASC);
  }

  public static SortBy desc(String sortColumn){
    return new SortBy(sortColumn, SortModeEnum.DESC);
  }
}
